/*
 * QIpCamera.h
 *
 *  Created on: Oct 27, 2010
 *      Author: Alexey Brodkin
 */

#ifndef QIPCAMERA_H_
#define QIPCAMERA_H_


#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QString>
#include <QTimer>
#include <QPixmap>


class QIpCamera : public QObject {
    Q_OBJECT
public:
    QIpCamera(int i, QString url_string);
    ~QIpCamera();
    void setPeriod(int period);
    void stop();
    void start();
    bool isInitialized();

private:
    int instance;
    bool active;
    bool inited;
    QUrl * url;
    QNetworkAccessManager * network_manager;
    QTimer * timer;
    QNetworkRequest request;

signals:
    void newImage(int i, QPixmap);
    
private slots:
    void slot_network_manager_finished(QNetworkReply * reply);
    void slot_timer_timeout();
};

#endif /* QIPCAMERA_H_ */
